import java.awt.*;
import java.awt.event.*;
import java.util.LinkedList;

public abstract class Tool {
  protected ShapeObject sobj = null;
  protected DrawingCanvas canvas;
  protected LinkedList ShapeObjects;
  protected MDUser mdUser;
	
  abstract void mousePressed(MouseEvent e);
  abstract void mouseReleased(MouseEvent e);
  abstract void mouseDragged(MouseEvent e);
  
  abstract void keyPressed(KeyEvent e);
  
  public Tool(DrawingCanvas canvas, LinkedList<ShapeObject> ShapeObjects, MDUser mdUser) {
	   this.canvas = canvas;
	   this.ShapeObjects=ShapeObjects;
	   this.mdUser = mdUser;
  }
	public void paintObjects(int mode){
		if(mode == 1){ // 1 ==> no update to server
			canvas.clearCanvas();
			for(int i=0;i<ShapeObjects.size();i++){
				((ShapeObject)ShapeObjects.get(i)).drawShape(canvas);
			}
		}else{ // 0 ==> server update
			mdUser.remoteOut.println("<<UPDATESHAPES>>");
		}
		canvas.repaint();
	}
}
